﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework;
namespace KinectTD.Input
{
    static class MouseHelper
    {
        private static MouseState oldMouseState, newMouseState;
        /// <summary>
        /// Gets the current state of the mouse
        /// </summary>
        public static MouseState CurrentMouseState
        {
            get { return newMouseState; }
        }

        /// <author>Nicholas Robinson</author>
        /// <summary>
        /// Gets the current position of the mouse
        /// </summary>
        /// <returns>A Point of the mouse position</returns>
        public static Point MousePosition
        {
            get { return new Point(newMouseState.X, newMouseState.Y); }
        }

        /// <summary>
        /// Returns whether or not the left mouse button has been held
        /// </summary>
        /// <returns>The result of the button state check</returns>
        public static bool MouseLeftHeld
        {
            get { return newMouseState.LeftButton == ButtonState.Pressed; }
        }

        /// <summary>
        /// Returns wheter or not the right mouse button has been held
        /// </summary>
        /// <returns>The result of the button state check</returns>
        public static bool MouseRightHeld
        {
            get { return newMouseState.RightButton == ButtonState.Pressed; }
        }


        /// <summary>
        /// Returns wheter or not the right mouse button has been held
        /// </summary>
        /// <returns>The result of the button state check</returns>
        public static bool MouseMiddleHeld
        {
            get { return newMouseState.MiddleButton == ButtonState.Pressed; }
        }



        /// <summary>
        /// Returns whether the left mouse button has been pressed
        /// </summary>
        /// <returns>The result of the button state check</returns>
        public static bool MouseLeftPressed
        {
            get { return (oldMouseState.LeftButton == ButtonState.Released && newMouseState.LeftButton == ButtonState.Pressed); }

        }

      
        /// <summary>
        /// Returns whether the right mouse button has been pressed
        /// </summary>
        /// <returns>The result of the button state check</returns>
        public static bool MouseRightPressed
        {
            get { return (oldMouseState.RightButton == ButtonState.Released && newMouseState.RightButton == ButtonState.Pressed); }

        }

     
        /// <summary>
        /// Returns whether the middle mouse button has been pressed
        /// </summary>
        /// <returns>The result of the button state check</returns>
        public static bool MouseMiddlePressed
        {
            get { return (oldMouseState.MiddleButton == ButtonState.Released && newMouseState.MiddleButton == ButtonState.Pressed); }

        }

        public static void Update()
        {
            oldMouseState = newMouseState;

       
           
            newMouseState = Mouse.GetState();
           
        }

    }
}
